<%@ taglib uri="/tld/extremecomponents" prefix="ec" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %> 

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

	<script src = "../js/jquery-1.12.1.js" type = "text/javascript"></script>
	<script src = "../js/common.js" type = "text/javascript"></script>
	
	<link href="<%=request.getContextPath() %>/css/extremecomponents.css" rel="stylesheet" type="text/css" />
	<link href="<%=request.getContextPath() %>/css/global.css" rel="stylesheet" type="text/css" />
	<link rel="stylesheet" type="text/css" href="<%=request.getContextPath() %>/css/H-ui.min.css" />
	<link rel="stylesheet" type="text/css" href="<%=request.getContextPath() %>/css/H-ui.admin.css" />
	<link rel="stylesheet" type="text/css" href="<%=request.getContextPath() %>/css/iconfont.css" />
	<link rel="stylesheet" type="text/css" href="<%=request.getContextPath() %>/css/skin.css" id="skin" />
	<link rel="stylesheet" type="text/css" href="<%=request.getContextPath() %>/css/style.css" />
<title>作业完成情况整体分析</title>
</head>
<script type="text/javascript">

	//作业框回显
	$(function() {
	$("select[name='jobId']")
	.val(
	'<c:out value="${CONDITIONMAP.jobId}" />');
	});

	$(function() {
	$("#lookfor").click(
        function() {
            formPost(window.SearchState, '','jobcomplete?ActionType=job_Complete_Status_Detail', this);
        });
	});

</script>
<body>
<div id="current">当前位置：作业完成情况分析  &gt; 详细分析</div>
<div class="page-container">

    <form id="SearchState" method="post">
	<div class="text-c"> 
	
		作业:
		<span class="select-box inline">
			<select class="select"  name="jobId" id="jobId">
				<option value="" selected="selected">本次作业</option>
				<c:forEach items="${ALLJOB }"  var="everyJob">
				<option value="${everyJob.job_id }">${everyJob.job_id }</option>
				</c:forEach>
			</select>
		</span>
		题目:
		<span class="select-box inline">
			<select class="select"  name="topicIds" id="topicId">
				<option value="" selected="selected">请选择题目</option>
				<c:forEach items="${ALLTOPIC}"  var="everyTopic">
				<option value="${everyTopic.topic_only_id }">${everyTopic.topic_abstract }</option>
				</c:forEach>
			</select>
		</span>
		<input type="hidden" id="" name="">
		<button id="lookfor" type="button" class="btn btn-primary radius">查询</button>
	</div>
	</form>
	
	<div class="mt-20">
		<table class="table table-border table-bordered table-bg table-hover table-sort">
			<thead>
				<tr class="text-c">
					<!-- <th width="25"><input type="checkbox" name="" value=""></th> -->
					<th width="105">题号</th>
					<th width="105">题目名</th>
					<th width="105">应交</th>
					<th width="105">已交</th>
					<th width="105">补交</th>
					<th width="105">补交率</th>
					<th width="105">未交</th>
					<th width="105">未交率</th>
				</tr>
			</thead>
			<tbody>
					 <c:forEach items="${JOBCOMPLETESTATUSDETAIL}"  var="currentJob">
					 <tr class="text-c">
					               <input class="topic_id" name="topicId"     type="hidden"    value="${currentJob.topic_id}"/>
	                               <td>${currentJob.topic_no}</td>
	                               <td>${currentJob.topic_abstract}</td>
	                               <td><span  onClick="should(this)">${currentJob.payable}</span></td>
	                               <td><span  onClick="normal(this)">${currentJob.normal}</span></td>
	                               <td><span  onClick="supplementary(this)">${currentJob.supplementary}</span></td>
	                               <td>${currentJob.supplementary/currentJob.payable*100 }%</td>
	                               <td><span  onClick="overdue(this)">${currentJob.overdue}</span></td>
	                               <td>${currentJob.overdue/currentJob.payable*100}%</td>
	                   </tr>
	                  </c:forEach>
			</tbody>
		</table>
	</div>
</div>

<script type="text/javascript">
	//应交人数点击事件
	function should(e){
		var shouldCount=$(e).text();
		var jobId=$("#jobId").val();
		var topicId=$(e).parent().parent().find(".topic_id").val(); 
		$.ajax({
	       type : "post",
	       dataType: "json",
	       url : "jobcomplete?ActionType=job_Complete_Status_Detail_All",
	       data :  {"JOB_ID":jobId,"TOPIC_ID":topicId},
	       success : function(message) {
	    	   var nameList=new Array();
	    	   $.each(message, function(i,student) {
	    		   nameList.push(student.student_name);
       			});
	           	confirm("应交作业学生名单为：\n"+nameList); 
	           	//在页面上弹出确认对话框
	       }
	   });
	}; 
	
	//正常提交人数点击事件
	function normal(e){
		var shouldCount=$(e).text();
		var jobId=$("#jobId").val();
		var topicId=$(e).parent().parent().find(".topic_id").val();
		if(shouldCount==0){
			alert("本题没有正常提交的学生");
		}else{
			$.ajax({
			       type : "post",
			       dataType: "json",
			       url : "jobcomplete?ActionType=job_Complete_Status_Detail_Normal",
			       data :  {"JOB_ID":jobId,"TOPIC_ID":topicId},
			       success : function(message) {
			    	   var nameList=new Array();
			    	   $.each(message, function(i,student) {
			    		   nameList.push(student.student_name);
		       			});
			           	confirm("正常提交作业学生名单为：\n"+nameList); 
			           	//在页面上弹出确认对话框
			       }
			   });
		}
	}; 
	
	//补交学生点击事件
	function supplementary(e){
		var shouldCount=$(e).text();
		var jobId=$("#jobId").val();
		var topicId=$(e).parent().parent().find(".topic_id").val(); 
		if(shouldCount==0){
			alert("本题没有补交的学生");
		}else{
			$.ajax({
			       type : "post",
			       dataType: "json",
			       url : "jobcomplete?ActionType=job_Complete_Status_Detail_Supplementary",
			       data :  {"JOB_ID":jobId,"TOPIC_ID":topicId},
			       success : function(message) {
			    	   var nameList=new Array();
			    	   $.each(message, function(i,student) {
			    		   nameList.push(student.student_name);
		       			});
			           	confirm("补交作业学生名单为：\n"+nameList); 
			           	//在页面上弹出确认对话框
			       }
			   });
		}
	}; 
	
	//未交学生点击事件
	function overdue(e){
		var shouldCount=$(e).text();
		var jobId=$("#jobId").val();
		var topicId=$(e).parent().parent().find(".topic_id").val(); 
		if(shouldCount==0){
			alert("本题没有未交的学生");
		}else{
			$.ajax({
			       type : "post",
			       dataType: "json",
			       url : "jobcomplete?ActionType=job_Complete_Status_Detail_Overdue",
			       data :  {"JOB_ID":jobId,"TOPIC_ID":topicId},
			       success : function(message) {
			    	   var nameList=new Array();
			    	   $.each(message, function(i,student) {
			    		   nameList.push(student.student_name);
		       			});
			           	confirm("未交作业学生名单为：\n"+nameList); 
			           	//在页面上弹出确认对话框
			       }
			   });
		}
	}; 
</script>
</body>
</html>